package com.atguigu.excel.write;

import com.alibaba.excel.EasyExcel;
import com.atguigu.excel.Stu;

import java.util.ArrayList;
import java.util.List;

public class WriteExcel {
    public static void main(String[] args) {
        //没有会自己创建
        String fileName = "D:\\WLin\\0419.xlsx";
        //workbook sheet
        EasyExcel.write(fileName, Stu.class).sheet("写入数据").doWrite(getData());
    }
    private static List<Stu> getData() {
        List<Stu> list = new ArrayList<Stu>();
        for (int i = 0; i < 10; i++) {
            Stu data = new Stu();
            data.setSno(i);
            data.setSname("张三"+i);
            list.add(data);
        }
        return list;
    }
}
